import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'IndexView',
    component: () => import('../views/IndexView.vue')
  },
  {
    path: '/category',
    name: 'categoryView',
    component: () => import('../views/CategoryView.vue')
  },
  {
    path: '/article/detail',
    name: 'articleView',
    component: () => import('../views/ArticleView.vue')
  },
  {
    path: '/timeline',
    name: 'timelineView',
    component: () => import('../views/TimelineView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/admin/LoginView.vue')
  }, {
    path: '/admin',
    name: 'admin',
    redirect: '/admin/echarts',
    component: () => import('../views/admin/AdminView.vue'),
    children: [
      {
        path: 'echarts',
        name: 'echarts',
        component: () => import('../views/admin/EchartsView.vue')
      }, {
        path: 'user',
        name: 'userList',
        component: () => import('../views/admin/user/UserList.vue')
      }, {
        path: 'banner',
        name: 'bannerList',
        component: () => import('../views/admin/banner/BannerList.vue')
      }, {
        path: 'href',
        name: 'hrefList',
        component: () => import('../views/admin/href/HrefList.vue')
      }, {
        path: 'category',
        name: 'categoryList',
        component: () => import('../views/admin/category/CategoryList.vue')
      }, {
        path: 'website',
        name: 'website',
        component: () => import('../views/admin/website/WebsiteUpdate.vue')
      }, {
        path: 'apply',
        name: 'articleUpdate',
        component: () => import('../views/admin/article/ArticleUpdate.vue')
      },
      {
        path: 'article',
        name: 'articleList',
        component: () => import('../views/admin/article/ArticleList.vue')
      }, {
        path: 'comment',
        name: 'commentList',
        component: () => import('../views/admin/comment/CommentList.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
